-
Notifications
You must be signed in to change notification settings - Fork 13.3k
bootstrap: fix clean's remove_dir_all implementation #129187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bootstrap: fix clean's remove_dir_all implementation #129187
Conversation
This PR modifies If appropriate, please update |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
…nks, r=<try> bootstrap: fix clean's remove_dir_all implementation It turns out bootstrap's `clean.rs`'s hand-rolled `rm_rf` (which probably comes before `std::fs::remove_dir_all` was stable) is very broken on native Windows around both read-only files/directories and especially symbolic links. So instead of rolling our own, just use `std::fs::remove_dir_all`. Because I wasn't super sure about `std::fs::remove_dir_all`'s behavior and to catch `std::fs::remove_dir_all`'s behavioral changes here on forward, I added a collection of tests that checks if our expectation of the behavior of `std::fs::remove_dir_all` and its underlying Unix syscalls and Win32 APIs matches with its actual behavior. This is a blocker for compiletest's own `rm_rf` implementation rust-lang#129155 which happens to be also buggy, which in turn is a blocker for the rmake.rs test port rust-lang#128562 that heavily exercises symlinks (I was reviewing rust-lang#128562 and testing it on native Windows which is how I found out). I also left a FIXME for `detect_src_and_out` due to a failing assertion on native Windows: ``` ---- core::config::tests::detect_src_and_out stdout ---- thread 'core::config::tests::detect_src_and_out' panicked at src\core\config\tests.rs:72:13: assertion `left == right` failed left: "E:\\tmp" right: "C:\\tmp" ``` Fixes rust-lang#112544 (because now we handle Windows symlinks properly). try-job: x86_64-msvc try-job: i686-mingw try-job: test-various try-job: armhf-gnu try-job: aarch64-apple try-job: aarch64-gnu
This comment has been minimized.
This comment has been minimized.
I feel like the |
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
I might actually remove the tests because std already has some for |
e736cb4
to
1ef814a
Compare
This comment has been minimized.
This comment has been minimized.
1ef814a
to
c762aa6
Compare
c762aa6
to
8af5c0a
Compare
@rustbot ready |
@bors try |
☀️ Try build successful - checks-actions |
For some reason, after this we're getting some failures with I tried it with a freshly-cloned version of rust and was able to reproduce as:
Creating a |
Ah, I believe that's fixed in std by #127623 In the meantime bootstrap will need a workaround that skips deleting directories that don't exist. EDIT: Oh, maybe not fixed as it would still error on the top-level directory. So the workaround would need to be permanent. |
Oh wait. I think I didn't consider the top-level directory missing but was ultrafocused on read-only/symlinks of nested directory entries. I'm going to revert the two PRs then reland the PRs properly accounting for missing top-level directories. |
Thanks for the heads up! This PR and the compiletest PR is indeed the culprit. My apologies for borking the buildsystem. |
Revert PR is up at #129413. |
It turns out bootstrap's
clean.rs
's hand-rolledrm_rf
(which probably comes beforestd::fs::remove_dir_all
was stable) is very broken on native Windows around both read-only files/directories and especially symbolic links. So instead of rolling our own, just usestd::fs::remove_dir_all
.This is a related to compiletest's own
rm_rf
implementation #129155 which happens to be also buggy, which in turn is a blocker for the rmake.rs test port #128562 that heavily exercises symlinks (I was reviewing #128562 and testing it on native Windows which is how I found out).Fixes #112544 (because now we handle Windows symlinks properly).
try-job: x86_64-msvc
try-job: i686-mingw
try-job: test-various
try-job: armhf-gnu
try-job: aarch64-apple
try-job: aarch64-gnu